import 'package:app/theme/design_tokens.dart';
import 'package:flutter/material.dart';

// App主题设置
class AppTheme {
  /// 浅色模式配置
  static ThemeData lightTheme(BuildContext context) {
    return ThemeData(
      brightness: MediaQuery.of(context).platformBrightness,
      // colorScheme主题设置(surface：Widget的背景色)
      colorScheme: ColorScheme.light(primary: DesignTokens.primaryColor),

      // appBar主题设置
      appBarTheme: const AppBarTheme(
          centerTitle: true,
          titleTextStyle: TextStyle(
              color: Colors.black, fontSize: 16, fontWeight: FontWeight.w700),
          iconTheme: IconThemeData(color: Colors.black)),

      // InputDecoration主题设置(TextFormField)
      inputDecorationTheme: const InputDecorationTheme(
        border: OutlineInputBorder(borderSide: BorderSide.none),
        hintStyle: TextStyle(color: Colors.grey, fontSize: 14),
      ),

      // ElevatedButton主题设置
      elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
        backgroundColor: DesignTokens.primaryColor,
        foregroundColor: Colors.white, // 前景色设置(可以覆盖colorSchema中的primary)
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
      )),

      // textButton主题设置
      textButtonTheme: TextButtonThemeData(
          style: TextButton.styleFrom(
              foregroundColor: Colors.black, // 前景色设置(可以覆盖colorSchema中的primary)
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8)))),

      // listTile主题设置
      // listTileTheme: ListTileThemeData(
      //     titleTextStyle: TextStyle(
      //       color: Colors.black,
      //       fontSize: 14,
      //     ),
      //     minTileHeight: 60,
      //     leadingAndTrailingTextStyle: TextStyle(
      //       fontSize: 15,
      //       color: Color(0xFF747474),
      //       overflow: TextOverflow.ellipsis,
      //     ),
      //     dense: false),
      //  divider主题设置
    );
  }

  /// 深色模式配置
  static ThemeData darkTheme(BuildContext context) {
    return ThemeData(
        brightness: MediaQuery.of(context).platformBrightness,
        appBarTheme: const AppBarTheme(
            centerTitle: true,
            backgroundColor: Colors.black,
            titleTextStyle: TextStyle(color: Colors.white, fontSize: 20),
            iconTheme: IconThemeData(color: Colors.white)),
        scaffoldBackgroundColor: Colors.black,
        // colorScheme: ColorScheme.dark(),
        bottomNavigationBarTheme:
            const BottomNavigationBarThemeData(backgroundColor: Colors.black),
        drawerTheme: DrawerThemeData(backgroundColor: Colors.black),
        listTileTheme: ListTileThemeData(textColor: Colors.white),
        textTheme: TextTheme(
            // displayLarge: TextStyle(color: Colors.white),
            // displayMedium: TextStyle(color: Colors.white),
            // displaySmall: TextStyle(color: Colors.white),
            // titleLarge: TextStyle(color: Colors.white),
            // titleMedium: TextStyle(color: Colors.white),
            // titleSmall: TextStyle(color: Colors.white),
            // bodyMedium: TextStyle(color: Colors.red),
            // bodyLarge: TextStyle(color: Colors.white),
            // bodySmall: TextStyle(color: Colors.white),
            // headlineLarge: TextStyle(color: Colors.white),
            // headlineMedium: TextStyle(color: Colors.white),
            // headlineSmall: TextStyle(color: Colors.white),
            // labelLarge: TextStyle(color: Colors.white),
            // labelMedium: TextStyle(color: Colors.white),
            // labelSmall: TextStyle(color: Colors.white),
            ));
  }
}
